#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/12/18 12:01
# @Author  : Beam
# @Site    : 
# @File    : serverinfo.py
# @Software: PyCharm

from django.shortcuts import render
from autocmdb import models


def serverinfo(request):
	hardwares = models.Hardware.objects.all()
	username = request.session.get('username')
	return render(request,'serverinfo.html',{'hardwares':hardwares,'username':username})


def detailed(request,sid):
	hardware = models.Hardware.objects.filter(id=sid).first()
	disks = models.DiskUseInfo.objects.filter(server=sid).all()
	networks = models.NetworkInfo.objects.filter(server=sid).all()
	username = request.session.get('username')
	return render(request, 'detailed.html',{'hardware':hardware,'disks':disks,'networks':networks,'username':username})